<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Colors: GDK 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GDK 3 Reference Manual">
<link rel="up" href="rn02.html" title="Deprecated">
<link rel="prev" href="rn02.html" title="Deprecated">
<link rel="next" href="GdkDeviceManager.html" title="GdkDeviceManager">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gdk3-Colors.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="rn02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="rn02.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GdkDeviceManager.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gdk3-Colors"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-Colors.top_of_page"></a>Colors</span></h2>
<p>Colors — Manipulation of colors</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gdk3-Colors.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="returnvalue">GdkColor</span></a> *
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-copy" title="gdk_color_copy ()">gdk_color_copy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-free" title="gdk_color_free ()">gdk_color_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-parse" title="gdk_color_parse ()">gdk_color_parse</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-equal" title="gdk_color_equal ()">gdk_color_equal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-hash" title="gdk_color_hash ()">gdk_color_hash</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="gdk3-Colors.html#gdk-color-to-string" title="gdk_color_to_string ()">gdk_color_to_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk3-Colors.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody><tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor">GdkColor</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk3-Colors.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gdk/gdk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Colors.description"></a><h2>Description</h2>
<p>A <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> represents a color.</p>
<p>When working with cairo, it is often more convenient
to use a <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a> instead, and <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> has been
deprecated in favor of <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a>.</p>
</div>
<div class="refsect1">
<a name="gdk3-Colors.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gdk-color-copy"></a><h3>gdk_color_copy ()</h3>
<pre class="programlisting"><a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="returnvalue">GdkColor</span></a> *
gdk_color_copy (<em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_copy</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>Makes a copy of a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</p>
<p>The result must be freed using <a class="link" href="gdk3-Colors.html#gdk-color-free" title="gdk_color_free ()"><code class="function">gdk_color_free()</code></a>.</p>
<div class="refsect3">
<a name="gdk-color-copy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>color</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-color-copy.returns"></a><h4>Returns</h4>
<p> a copy of <em class="parameter"><code>color</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-free"></a><h3>gdk_color_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_color_free (<em class="parameter"><code><a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_free</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>Frees a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> created with <a class="link" href="gdk3-Colors.html#gdk-color-copy" title="gdk_color_copy ()"><code class="function">gdk_color_copy()</code></a>.</p>
<div class="refsect3">
<a name="gdk-color-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>color</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-parse"></a><h3>gdk_color_parse ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gdk_color_parse (<em class="parameter"><code>const <span class="type">gchar</span> *spec</code></em>,
                 <em class="parameter"><code><a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_parse</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>Parses a textual specification of a color and fill in the
<em class="parameter"><code>red</code></em>
, <em class="parameter"><code>green</code></em>
, and <em class="parameter"><code>blue</code></em>
 fields of a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</p>
<p>The string can either one of a large set of standard names
(taken from the X11 <code class="literal">rgb.txt</code> file), or it can be a hexadecimal
value in the form “#rgb” “#rrggbb”, “#rrrgggbbb” or
“#rrrrggggbbbb” where “r”, “g” and “b” are hex digits of
the red, green, and blue components of the color, respectively.
(White in the four forms is “#fff”, “#ffffff”, “#fffffffff”
and “#ffffffffffff”).</p>
<div class="refsect3">
<a name="gdk-color-parse.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>spec</p></td>
<td class="parameter_description"><p>the string specifying the color</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>color</p></td>
<td class="parameter_description"><p>the <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> to fill in. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-color-parse.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the parsing succeeded</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-equal"></a><h3>gdk_color_equal ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gdk_color_equal (<em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colora</code></em>,
                 <em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colorb</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_equal</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>Compares two colors.</p>
<div class="refsect3">
<a name="gdk-color-equal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>colora</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>colorb</p></td>
<td class="parameter_description"><p>another <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-color-equal.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the two colors compare equal</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-hash"></a><h3>gdk_color_hash ()</h3>
<pre class="programlisting"><span class="returnvalue">guint</span>
gdk_color_hash (<em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_hash</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>A hash function suitable for using for a hash
table that stores <a href="gdk3-Colors.html#GdkColor"><span class="type">GdkColors</span></a>.</p>
<div class="refsect3">
<a name="gdk-color-hash.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>color</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-color-hash.returns"></a><h4>Returns</h4>
<p> The hash function applied to <em class="parameter"><code>color</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-to-string"></a><h3>gdk_color_to_string ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
gdk_color_to_string (<em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_color_to_string</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>Returns a textual specification of <em class="parameter"><code>color</code></em>
 in the hexadecimal
form “#rrrrggggbbbb” where “r”, “g” and “b” are hex digits
representing the red, green and blue components respectively.</p>
<p>The returned string can be parsed by <a class="link" href="gdk3-Colors.html#gdk-color-parse" title="gdk_color_parse ()"><code class="function">gdk_color_parse()</code></a>.</p>
<div class="refsect3">
<a name="gdk-color-to-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>color</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-color-to-string.returns"></a><h4>Returns</h4>
<p> a newly-allocated text string</p>
</div>
<p class="since">Since: 2.12</p>
</div>
</div>
<div class="refsect1">
<a name="gdk3-Colors.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GdkColor"></a><h3>GdkColor</h3>
<pre class="programlisting">typedef struct {
  guint32 pixel;
  guint16 red;
  guint16 green;
  guint16 blue;
} GdkColor;
</pre>
<div class="warning">
<p><code class="literal">GdkColor</code> has been deprecated since version 3.14 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p>
</div>
<p>A <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> is used to describe a color,
similar to the XColor struct used in the X11 drawing API.</p>
<div class="refsect3">
<a name="GdkColor.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><span class="type">guint32</span> <em class="structfield"><code><a name="GdkColor.pixel"></a>pixel</code></em>;</p></td>
<td class="struct_member_description"><p>For allocated colors, the pixel value used to
draw this color on the screen. Not used anymore.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">guint16</span> <em class="structfield"><code><a name="GdkColor.red"></a>red</code></em>;</p></td>
<td class="struct_member_description"><p>The red component of the color. This is
a value between 0 and 65535, with 65535 indicating
full intensity</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">guint16</span> <em class="structfield"><code><a name="GdkColor.green"></a>green</code></em>;</p></td>
<td class="struct_member_description"><p>The green component of the color</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">guint16</span> <em class="structfield"><code><a name="GdkColor.blue"></a>blue</code></em>;</p></td>
<td class="struct_member_description"><p>The blue component of the color</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>